<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>业务功能首页</title>
<link rel="stylesheet" href="<%=path%>/css/bootstrap.min.css" />
<link rel="stylesheet" href="<%=path%>/css/easyui.css" />
<link rel="stylesheet" href="<%=path%>/css/icon.css" />
<link rel="stylesheet"
	href="https://cdn.bootcss.com/bootstrap/4.1.0/css/bootstrap.min.css">
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/popper.js/1.12.5/umd/popper.min.js"></script>
<script
	src="https://cdn.bootcss.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<style>
body {
	background-color: #f1f1f1;
}

.lightBg {
	background-color: #fff;
	padding: 5px 20px;
}
</style>
</head>
<body>

	<div class="container">
		<div class="row lightBg">
			<!--标题-->
			<h2 class="pull-left">
				<img src="<%=path%>/images/logo.png" style="width: 80px;">
				智游科技项目申报系统
			</h2>
			<p class="pull-right" style="margin-top: 20px;">
				欢迎您，项目负责人 ${user.UName }&nbsp;|&nbsp;<a href="">站内消息(2)</a>&nbsp;<a
					href="<%=path%>/news/toIndex2">退出</a>
			</p>
		</div>
		<div class="row" style="margin-top: 20px;">
			<!--页面一二级菜单部分，公用的-->
			<div class="easyui-tabs" style="">
				<div title="首页" style="padding:10px">首页暂无设计</div>
				<div title="申报管理" style="padding:10px">
					<div class="easyui-panel" style="padding:5px;">
						<a href="<%=path %>/report?uid=${user.UId}"
							class="easyui-linkbutton" data-options="plain:true">填写申请书</a>
					</div>
				</div>
				<div title="项目管理" style="padding:10px">
					<div class="easyui-panel" style="padding:5px;">
						<a href="<%=path%>/toprincipal" class="easyui-linkbutton"
							data-options="plain:true">查看项目</a>
					</div>
				</div>
				<div title="拨款管理" style="padding:10px">此功能暂不实现</div>
				<div title="系统管理" style="padding:10px" data-options="plain:true">
					<div class="easyui-panel" style="padding:5px;">
						<a href="<%=path%>/user/my?id=${user.UId}"
							class="easyui-linkbutton" data-options="plain:true">个人信息维护</a> <a
							href="<%=path%>/user/personal?id=${user.UId}"
							class="easyui-linkbutton" data-options="plain:true"
							style="background:  #B0E0E6;">个人账号管理</a>
						<!--<a href="#" class="easyui-menubutton" data-options="menu:'#mm2'">单位信息维护</a>-->
					</div>
				</div>
			</div>
		</div>
		<div class="row" style="background-color: #fff;">
			&nbsp;&nbsp;<img alt="" style="height: 60px; width:60px "
				src="<%=path%>/images/85-view-media-artist.png">&nbsp;&nbsp;&nbsp;<span
				style="font-size: 24px;vertical-align: middle;">基本信息</span>
			<hr>
			<table align="center" cellpadding="10" cellspacing="5"
				style="width: 80%;height: 150px">
				<tr>
					<th align="left">电子邮箱:</th>
					<td>${user.UEamil }</td>
					<td><c:if test="${user.UStatus==0 }">
							<a href="#">验证邮箱</a>
						</c:if> <c:if test="${user.UStatus!=0 }">
							<span style="color: green;">已验证</span>
						</c:if></td>
				</tr>
				<tr>
					<th align="left">手机号码:</th>
					<td>${user.UPhone }</td>
					<td><c:if test="${user.UStatus<=1 }">
							<a
								href="javascript:save(${user.UStatus },${user.UPhone },${user.UId })">验证号码</a>
						</c:if> <c:if test="${user.UStatus>1 }">
							<span style="color: green;">已验证</span>
						</c:if></td>
				</tr>
				<tr>
					<th align="left">登录账号:</th>
					<td>${user.login.LId }</td>
				</tr>
			</table>
		</div>
		<hr>
		<div class="row" style="background-color: #fff;">
			&nbsp;&nbsp;
			<c:if test="${user.UStatus<2 }">
				<img alt="" style="height: 60px; width:60px "
					src="<%=path%>/images/248-security-medium.png">
			</c:if>
			<c:if test="${user.UStatus>=2 }">
				<img alt="" style="height: 60px; width:60px "
					src="<%=path%>/images/250-security-high.png">
			</c:if>
			&nbsp;&nbsp;&nbsp;<span
				style="font-size: 24px;vertical-align: middle;">安全服务</span>
			<hr>
			<table align="center" cellpadding="3" cellspacing="3"
				style="width: 80%;height: 150px">
				<tr>
					<th align="left">登录密码</th>
					<td></td>
					<td align="center"><span style="color:  #666666">安全性高的密码可以是密码更安全！建议你经常修改密码</span></td>
					<td>
						<button type="button" class="btn btn-primary" data-toggle="modal"
							data-target="#myModal">修改密码</button>
					<td>
				</tr>
				<tr>
					<th align="left">验证邮箱</th>
					<td><c:if test="${user.UStatus==0 }">
							<img alt="" style="height: 30px; width:30px "
								src="<%=path%>/images/698-dialog-error.png">
							<span style="color: red;">未验证</span>
						</c:if> <c:if test="${user.UStatus!=0 }">
						</c:if></td>
					<td align="center"><span style="color:  #666666">验证邮箱后可以享受更多功能！</span></td>
					<td><c:if test="${user.UStatus==0 }">
							<a href="#">验证邮箱</a>
						</c:if> <c:if test="${user.UStatus!=0 }">
							<span style="color: green;">已验证</span>
						</c:if>
					<td>
				</tr>
				<tr>
					<th align="left">验证手机</th>
					<td><c:if test="${user.UStatus<=1 }">
							<img alt="" style="height: 30px; width:30px "
								src="<%=path%>/images/698-dialog-error.png">
							<span style="color: red;">未验证</span>
						</c:if> <c:if test="${user.UStatus>1 }">
						</c:if></td>
					<td align="center"><span style="color:  #666666">验证手机号后可以使您的账号更加安全！</span></td>
					<td><c:if test="${user.UStatus<=1 }">
							<a
								href="javascript:save(${user.UStatus },${user.UPhone },${user.UId })">验证号码</a>
						</c:if> <c:if test="${user.UStatus>1 }">
							<button type="button" class="btn btn-primary" data-toggle="modal"
								data-target="#myModal2">修改号码</button>
						</c:if>
					<td>
				</tr>
			</table>
		</div>
		<hr>
		<div class="row" style="background-color: #fff;">
			<table style="width: 80%;height: 150px" align="center">
				<tr>
					<th>编号</th>
					<th>开户行</th>
					<th>银行卡号</th>
					<th>操作</th>
				</tr>
				<c:forEach items="${banks }" var="b">
					<tr>
						<td>${b.BId }</td>
						<td>${b.BName }</td>
						<td>${b.BNo }</td>
						<td><button onclick="javascript:delBank(${b.BId })">删除</button></td>
					</tr>
				</c:forEach>
			</table>
		</div>

		<!-- 模态框 -->
		<div class="modal fade" id="myModal2">
			<div class="modal-dialog modal-sm">
				<div class="modal-content">

					<!-- 模态框头部 -->
					<div class="modal-header">
						<h4 class="modal-title">修改手机号</h4>
						<button type="button" class="close" data-dismiss="modal">&times;</button>
					</div>

					<!-- 模态框主体 -->
					<form action="<%=path%>/user/updatePhone">
						<input type="hidden" name="uid" value="${user.UId }">
						<div class="modal-body">
							请输入新的手机号码:<input type="text" name="phone" id="phone">
						</div>

						<!-- 模态框底部 -->
						<div class="modal-footer">
							<input type="submit" value="提交" class="btn btn-primary"
								disabled="disabled" id="sub2">
							<button type="button" class="btn btn-secondary"
								data-dismiss="modal">关闭</button>
						</div>
					</form>
				</div>
			</div>
		</div>

	</div>

	<div class="modal fade" id="myModal">
		<div class="modal-dialog">
			<div class="modal-content">
				<!-- 模态框头部 -->
				<div class="modal-header">
					<h4 class="modal-title">修改用户:${user.UName }的密码</h4>
					<button type="button" class="close" data-dismiss="modal">&times;</button>
				</div>
				<form action="<%=path%>/user/updatePwd" method="post">
					<p style="color: red;">密码长度8~16位，两次输入必须一致</p>
					<input type="hidden" name="LId" value="${user.login.LId }">
					<input type="hidden" name="uid" value="${user.UId }">
					<!-- 模态框主体 -->
					<div class="modal-body"></div>
					请输入新密码:<input type="password" id="pwd" name="LPwd"> 请再次输入:<input
						type="password" id="pwd2" name="pwd2">
					<!-- 模态框底部 -->
					<div class="modal-footer">
						<input type="submit" value="提交" class="btn btn-primary"
							disabled="disabled" id="sub">
						<button type="button" class="btn btn-secondary"
							data-dismiss="modal">关闭</button>
					</div>
				</form>
			</div>
		</div>
	</div>
	<script src="<%=path%>/js/jquery1.12.4.min.js"></script>
	<script src="<%=path%>/js/bootstrap.min.js"></script>
	<script src="<%=path%>/js/jquery.easyui.min.js"></script>
	<script type="text/javascript">
		$(function() {
			$('.easyui-tabs').tabs('select', '系统管理');
		})
	</script>
	<script src="<%=path%>/js/jquery-3.3.1.js"></script>
	<script type="text/javascript">
		$(function() {
	
			$('#pwd').blur(function() {
				var p1 = $('#pwd').val().length;
				if (p1 < 8 || p1 > 16)
					alert("密码格式错误！")
			})
	
			$('#pwd2').blur(function() {
				var p1 = $('#pwd').val();
				var p2 = $('#pwd2').val();
				if (p1 == p2)
					$("#sub").attr("disabled", false);
				else
					alert("两次输入不符合")
			})
	
			$("#phone").blur(function() {
				var phone = $("#phone").val().length;
				if (phone == 11)
					$("#sub2").attr("disabled", false);
				else
					alert("电话号码格式不正确")
			})
		})
		function save(Status, Phone, uid) {
			if (Status < 1) {
				alert("请先验证邮箱")
			} else {
				$.ajax({
					type : "GET",
					dataType : "json",
					url : "<%=path%>/user/sms?phone=" + Phone,
					success : function(result) {
						if (result == '400') {
							alert('错误');
						} else {
							var code = prompt("请输入验证码", "");
							if (code == result) {
								alert("正确")
								location.href = "<%=path%>/user/updateStaust?uid=" + uid;
								return;
							} else if (code === "") {
							} else {
							}
						}
						;
					}
				});
			}
		}
		function delBank(id) {
			var b = confirm("确认删除?")
			if (b)
				window.location.href = "<%=path%>/user/delBank?id=" + id;
		}
	</script>
</body>
</html>